import cv2 as cv
import numpy as np


def trackbar_callback(value):
    pass


def blur_image():
    src_img = cv.imread('..//lena.png')
    win_name = 'dst image'
    cv.imshow('source image', src_img)
    kernel = (5, 5)
    dst_img = cv.blur(src_img, kernel)
    cv.namedWindow(win_name, cv.WINDOW_NORMAL)
    cv.createTrackbar('kernel', win_name, 5, 20, trackbar_callback)
    while 1:
        value = cv.getTrackbarPos('kernel', win_name)
        kernel = (value+1, value+1)
        dst_img = cv.blur(src_img, kernel)
        cv.imshow(win_name, dst_img)
        key = cv.waitKey(5)
        if key == 27:
            break


if __name__ == '__main__':
    blur_image()


